package com.dal.common.utils;

import org.springframework.util.StringUtils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @description
 * @ClassName TestUtil
 * @Author jian
 * @Date 14:46 2024/8/12
 **/
public class TestUtil {
    public static void main(String[] args) {
        String s = "10:00</br>次日24:00(补)";
        s = s.replaceAll("次日", "");
        String[] splitss = s.split("</br>");
        System.err.println(splitss.length);
        for (String string : splitss) {
            System.err.println(string);

            if (string.contains("(补)")){
                string = string.substring(0,5);
                System.out.println(string);
            }
        }

        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
        try {
            // 解析时间
            Date time1 = sdf.parse("10:00");
            Date time2 = sdf.parse("10:00");
            //次日....
            // 将时间2设置为第二天的时间
            time2 = new Date(time2.getTime() + 24 * 60 * 60 * 1000);
            //次日结束...

            // 计算时间差
            long diffInMillis = time2.getTime() - time1.getTime();
            long diffInMinutes = diffInMillis / (60 * 1000);

            System.out.println("分钟差：" + diffInMinutes);
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
}
